package com.hdaccp.foodsales.controller;

import com.hdaccp.foodsales.dao.VipDao;
import com.hdaccp.foodsales.entity.Jinhuo;
import com.hdaccp.foodsales.entity.Shangpin;
import com.hdaccp.foodsales.entity.Vip;
import com.hdaccp.foodsales.service.VipService;
import com.hdaccp.foodsales.service.impl.VipServiceImpl;
import com.hdaccp.foodsales.service.shangpinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
@RequestMapping("/vip")
@Scope("prototype")
public class VipController {
    @Autowired
    private  VipService vipService;

    @Autowired
    private VipDao vipDao;

    @RequestMapping("/getvip")
    @ResponseBody
    public Vip getsid(String membername){

        System.out.println("--------------");
        return vipService.query(membername);
    }

    @RequestMapping("/cha")
    @ResponseBody
    public List<Vip> cha(HttpServletRequest request){

        List<Vip> list =vipDao.getAll();
        return list;
    }

    @RequestMapping("/getIds")
    @ResponseBody
    public Vip getIds(int id){
        return vipDao.getId(id);
    }

    @RequestMapping("/updatehys")
    @ResponseBody
    public int updatehys(Vip vip){
        return vipDao.updatehy(vip);
    }

}
